<template>
  <view class="pd dfgdfgtyxe">
    <view class="z9 fz24 pt20 pm20"> 请选择教学楼类型 </view>
    <view v-for="(item,index) in list" :key="index" 
      class="hhbnmjjcrert pr row pt20 pm20" @click="goLink(item.id)">
      <view class="dsfdsgty">
        <image
          :src="basicURL + item.fieldImgAddress"
          class="sdfgdsgty cz"
        ></image>
      </view>
      <view class="col dfgdfty pl40 ls">
        {{ item.name }}
      </view>
      <image src="../../../../static/img/righth.png" class="fdsgdrftyy"></image>
    </view>
  </view>
</template>
<script>
import store from "../../../../store/index.js";
export default {
  data() {
    return {
      url: "",
      list: [],
      basicURL: "",
    };
  },
  props: {
    api: {
      type: String,
      default: "fieldTypeManage",
    },
    isFen: { type: [Boolean], default: false },
  },
  components: {},
  methods: {
    async fieldTypeManage() {
      let that = this;
      let res = await this.$api[this.api]();
      if (res.code == 200) {
        // res.data = [
        // 	  {
        // 		"fieldImgAddress": "www.ssms.com",
        // 		"id": 201,
        // 		"name": "第一教学楼"
        // 	  }
        // 	]
        that.list = res.data;
      }
      // this.$store.commit("setUserInfo", res);
    },
    goLink(id) {
      let query = this.$mp ? this.$mp.page.options : this.$route.query
      uni.navigateTo({
         url: this.url +
        '?fieldId=' +
        id +
        '&startTime=' +
        query.startTime +
        '&endTime=' +
        query.endTime +
        '&applyFormId=' +
        query.applyFormId+
        '&note=' +
        query.note
      });
    }
  },
  mounted() {
    this.basicURL = store.getters.getBasicURL;
    this.fieldTypeManage();
    let path =''
    if( this.$mp) {
       path = this.$mp.page.route
    } else {
      path = this.$route.path
    }
    if (path.match("fenIndex")) {
      this.url = "/pages/index/classroom";
    } else {
      this.url = "/pages/gongzuo/guanli/jiaoxuelou";
    }
  },
};
</script>
<style scoped>
.hhbnmjjcrert {
  border: 1px solid #e0e0e0;
  border-radius: 8upx;
  height: 100upx;
  background: #fff;
  margin-bottom: 20upx;
  font-size: 28upx;
}
.sdfgdsgty {
  width: 60upx;
  height: 60upx;
  display: inline-block;
}
.dsfdsgty {
  width: 120upx;
  text-align: center;
  border-right: 1px solid #e0e0e0;
}
.dfgdfty {
  line-height: 60upx;
}
.fdsgdrftyy {
  width: 30upx;
  height: 30upx;
  position: absolute;
  right: 20upx;
  top: 35upx;
}
.dfgdfgtyxe {
  padding-bottom: 120upx;
}
</style>
